<template>
  <div class="header">
    <div class="headerWrap">
      <div>
        <div class="head-left head-item">
          <span class="logo-icon" @click="handlerGoDashboard">
            <i
              class="iconfont iconicon-logo"
              style="font-size: 24px; line-height: 50px"
            ></i>
          </span>
        </div>
      </div>
      <div>
        <div class="head-right head-item">
          <span class="operatingBtn">
            <a style="color: black" :href="helpDomainResolve" target="_blank">
              <i
                class="iconfont iconbianzu1"
                style="
                  margin-right: 3px;
                  font-size: 16px;
                  vertical-align: middle;
                "
              ></i>
              <b class="item-btn">帮助</b>
            </a>
          </span>
          <span class="operatingBtn">
            <i
              class="iconfont iconbianzu2"
              style="margin-right: 3px; font-size: 16px; vertical-align: middle"
            ></i>
            <b class="item-btn">通知</b>
          </span>
          <span
            style="line-height: 50px"
            @mouseenter="dropdownAvatarShow"
            @mouseleave="dropdownAvatarhide"
          >
            <p class="avatar" style="cursor: pointer">
              <img :src="headUrl" alt />
            </p>
            <dl
              class="login-set dropdown-avatar-menu"
              v-if="isdropdownAvatarShow"
            >
              <dd @click="pannelShow">个人设置</dd>
              <dd @click="signOut">退出控制台</dd>
            </dl>
          </span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { dashboardSiteDomain } from "@/environment/index";
import securityService from "@/services/authentication/securityService";
// import { setLocal } from "@/libs/local.js";
import { helpDomainResolve } from "@/environment/help-link.js";

export default {
  data() {
    return {
      helpDomainResolve: helpDomainResolve,
      isdropdownAvatarShow: false,
      appList: [],
      changeAppShow: false,
      appName: "",
      keyword: "",
    };
  },
  methods: {
    handlerGoDashboard() {
      location.href = dashboardSiteDomain;
    },
    signOut() {
      // setLocal("isShowTips", "1");
      securityService.signOut(location.href);
    },
    pannelShow() {
      if (this.changeAppShow) {
        this.changeAppShow = false;
      }
      this.$router.push({
        name: "personal",
      });
    },
    dropdownAvatarShow() {
      this.isdropdownAvatarShow = true;
    },
    dropdownAvatarhide() {
      this.isdropdownAvatarShow = false;
    },
    async changeAutoTranslate() {},

    /**
  
   
    /**
     * 关闭弹框
     */
    closeChangeApp() {
      this.changeAppShow = false;
    },
  },
  computed: {
    headUrl() {
      let avatar = this.$store.state.user.userInfo.headImageUrl;
      if (avatar) {
        return avatar;
      } else {
        return require("@/assets/defualtAvater.png");
      }
    },
    headAppName() {
      let appName = this.$store.state.user.userInfo.appName;
      return appName;
    },
  },
};
</script>
<style scoped>
.myApp /deep/ .el-dialog {
  overflow: hidden;
}
.myApp /deep/ .el-dialog__body {
  padding: 0;
}
.myApp /deep/ .el-dialog__header {
  padding: 0;
}
</style>
<style lang="scss" scoped>
.iconlogo1 {
  font-size: 24px;
}
.header {
  font-size: $--font-size-base;
  background: $--color-white;
  color: $--color-text-primary;
  position: relative;
  .headerWrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .head-item {
    .logo-icon {
      display: inline-block;
      width: 60px;
      height: 50px;
      box-sizing: border-box;
      padding: 0;
      text-align: center;
      vertical-align: top;
      background: $--color-primary;
      .iconfont {
        color: $--color-white;
      }
    }
    span {
      display: inline-block;
      padding: 0 15px;
      .item-btn {
        vertical-align: middle;
        padding-left: 5px;
      }
    }
    .headAppName {
      cursor: pointer;
      margin-left: 32px;
      padding: 0;
      .headAppNameInfo {
        padding: 0;
        margin-right: 12px;
      }
      &:hover {
        .headAppNameInfo {
          color: $--color-primary;
        }
        i {
          color: $--color-primary;
        }
      }
    }
    .autoTranslate-wrap {
      display: inline-block;
      margin-left: 30px;
      .autoTranslate-text {
        display: inline-block;
        font-size: $--font-size-small;
      }
      .autoTranslate-switch {
        margin-left: 8px;
      }
      /deep/ .el-switch {
        .el-switch__core {
          width: 20px;
          height: 12px;
          &:after {
            width: 10px;
            height: 10px;
            top: 0;
          }
        }
      }
      /deep/ .el-switch.is-checked {
        .el-switch__core {
          &:after {
            margin-left: -11px;
          }
        }
      }
    }
    .operatingBtn {
      cursor: pointer;
      &:hover {
        .iconfont {
          color: $--color-primary;
        }
      }
    }
  }
  .head-left {
    display: flex;
    align-items: center;
  }
  .head-right {
    text-align: right;
  }
  .avatar {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-right: 10px;
    vertical-align: middle;
    img {
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }
  }
  .login-set {
    cursor: pointer;
    text-align: left;
    background: #fff;
    color: $--color-text-primary;
    position: absolute;
    z-index: 10000;
    right: 0;
    top: 50px;
    border-radius: $--border-radius-base;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
    padding: 9px 0;
    dd {
      padding: 0 30px;
      line-height: 32px;
      &:hover {
        color: $--color-primary;
        background: $--background-color-hover;
      }
    }
  }
  .my-chose-app {
    position: relative;
  }
  .my-chose-app .dialog-fade-enter-active {
    animation: my-dialog-fade-in 0.3s;
  }
  .my-chose-app .dialog-fade-leave-active {
    animation: my-dialog-fade-out 0.3s;
  }
  @keyframes my-dialog-fade-in {
    0% {
      transform: translate3d(0, 100%, 0);
      opacity: 0;
    }
    100% {
      transform: translate3d(0, 0, 0);
      opacity: 1;
    }
  }

  @keyframes my-dialog-fade-out {
    0% {
      transform: translate3d(0, 0, 0);
      opacity: 1;
    }
    100% {
      transform: translate3d(0, 100%, 0);
      opacity: 0;
    }
  }
}
.myAppTitle {
  height: 50px;
  font-size: $--font-size-medium;
  color: $--color-text-primary;
  font-weight: $--font-weight-primary;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .iconguanbi {
    color: $--color-text-primary;
    &:hover {
      color: $--color-text-primary;
      background: $--icon-hover-color;
    }
  }
}
.appBackground {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(245, 245, 245, 1);
  border-top: 1px solid #eee;
  width: 100%;
  height: 100%;
  .app-title {
    margin-left: 50%;
    transform: translateX(-50%);
    height: 76px;
    width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .app-title-text {
      .app-title-border {
        display: inline-block;
        width: 2px;
        height: 17px;
        background: $--color-primary;
        margin-right: 12px;
      }
      display: flex;
      align-items: center;
      font-size: $--font-size-medium;
      color: $--color-text-primary;
      font-weight: $--font-weight-primary;
    }
    .input-with-select {
      width: 260px;
    }
  }
  .search-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100% - 76px);
    width: 100%;
  }
  .appitem {
    margin-left: 50%;
    transform: translateX(-50%);
    margin-bottom: 24px;
    width: 800px;
    height: 140px;
    background: $--color-white;
    border-radius: $--border-radius-base;
    padding-left: 0px;
    transition: all 0.2s linear;
    &:hover {
      box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.2);
      transform: translate(-50%, -2px);
    }
    .appTitle {
      width: 100%;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .appNameWrap {
        display: flex;
        align-items: center;
        .templateApp {
          margin-left: 24px;
          display: inline-block;
          width: 29px;
          height: 21px;
          background: url("~img/templateApp.png") no-repeat center;
          background-size: contain;
        }
        .normalApp {
          margin-left: 24px;
          display: inline-block;
          width: 29px;
          height: 21px;
          background: url("~img/normalApp.png") no-repeat center;
          background-size: contain;
        }
        .appName {
          margin-left: 16px;
          font-size: $--font-size-medium;
          color: $--color-text-primary;
          font-weight: $--font-weight-primary;
        }
      }
      .appMember {
        float: right;
        margin-right: 24px;
        font-size: $--font-size-small;
        color: $--color-text-primary;
        font-weight: $--font-weight-primary;
      }
    }
    .appInfo {
      width: 100%;
      height: 90px;
      background: rgba(250, 250, 252, 1);
      border-radius: 2px 2px 0px 0px;
      .version {
        line-height: normal;
        padding-top: 21px;
        .versionText {
          font-size: $--font-size-base;
          font-weight: $--font-weight-base;
          color: rgba(153, 153, 153, 1);
          margin-left: 24px;
          line-height: 22px;
        }
      }
      .expired {
        margin-top: 8px;
        line-height: normal;
        .expiredText {
          font-size: $--font-size-base;
          font-weight: $--font-weight-base;
          color: rgba(153, 153, 153, 1);
          margin-left: 24px;
        }
      }
      .isExpiredSoon {
        margin-left: 24px;
        display: inline-block;
        width: 57px;
        height: 19px;
        background: rgba(250, 100, 0, 0.2);
        border-radius: $--border-radius-base;
        font-size: $--font-size-small;
        font-weight: $--font-weight-primary;
        color: rgba(250, 100, 0, 1);
        line-height: 19px;
        text-align: center;
      }
      .isExpired {
        margin-left: 24px;
        display: inline-block;
        width: 46px;
        height: 19px;
        background: rgba(251, 77, 104, 0.2);
        border-radius: $--border-radius-base;
        font-size: $--font-size-small;
        font-weight: $--font-weight-primary;
        color: rgba(251, 77, 104, 1);
        line-height: 19px;
        text-align: center;
      }
      .choseApp {
        position: absolute;
        right: 24px;
        bottom: 16px;
      }
      .renewal {
        position: absolute;
        right: 130px;
        bottom: 16px;
        box-sizing: border-box;
        line-height: 1;
      }
    }
  }
  .appitem:last-of-type {
    margin-bottom: 40px;
  }
}
.icon_hover {
  color: rgb(215, 216, 217);
}
.icon_hover:hover {
  color: #999;
}
</style>